package moonhy.c2dm_client;

import moonhy.c2dm_client.dw.NoticeData;
import android.content.Context;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

public class NoticeListViewPage extends LinearLayout {

//	public NoticeListViewPage(Context context, AttributeSet attrs) {
//		super(context, attrs);
//		init(nd);
//	}

	public NoticeListViewPage(Context context, NoticeData nd ) {
		super(context);
		init(nd);
	}

	private void init(NoticeData nd) {
		
		
		//ArrayList<TextView> textList = new ArrayList<TextView>();
		LayoutParams params;
		
		ScrollView sv = new ScrollView(getContext());
		LinearLayout ll = new LinearLayout(getContext());
		ll.setOrientation(LinearLayout.VERTICAL);
		sv.addView(ll);
		
		TextView regDateView = new TextView(getContext());
		regDateView.setText("작성일: " + nd.getReg_date());
		regDateView.setTextColor(0xFFFFFFFF);
		regDateView.setBackgroundColor(0x99313029);
		regDateView.setPadding(20, 15, 20, 15);
		
		TextView contentView = new TextView(getContext());
		contentView.setText(nd.getContent());
		contentView.setTextColor(0xFF515151);
		contentView.setPadding(20, 10, 20, 10);
		
		params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		ll.addView(regDateView, params);
		params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		ll.addView(contentView, params);
		
		params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		addView(sv, params);
		
		//textList.add(regDateView);
		//textList.add(contentView);
		
		/*
		setBackgroundColor(Color.GREEN);

		ListView listView = new ListView(getContext());
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(),
				android.R.layout.simple_list_item_1);
		adapter.add("ListView 1 Item 1");
		adapter.add("ListView 1 Item 2");
		adapter.add("ListView 1 Item 3");
		adapter.add("ListView 1 Item 4");
		adapter.add("ListView 1 Item 5");
		adapter.add("ListView 1 Item 6");

		listView.setAdapter(adapter);

		LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		addView(listView, params);
		*/
		
	}

}